package creational.factory.simplefactory;

import creational.factory.DataBaseDialect;
import creational.factory.MysqlDialect;
import creational.factory.PostgresDialect;

/**
 * @Description: 简单方法
 * @Author: lxt
 * @CreateDate: 2019/11/1
 **/
public class SimpleFactory {
    public static DataBaseDialect getDialect(String databaseType) {
        DataBaseDialect dialect = null;
        if ("mysql".equalsIgnoreCase(databaseType)) {
            dialect = new MysqlDialect();
        } else if ("postgresql".equalsIgnoreCase(databaseType)) {
            dialect = new PostgresDialect();
        }
        return dialect;
    }
}
